<div class="seperator8"></div>
<div id="content-container">
<div class="ad728_90_bg">
<div class="ad728_90">
<script type="text/javascript">
/*百度横幅广告*/
var cpro_id = "u956732";
</script>
<script src="http://cpro.baidustatic.com/cpro/ui/c.js" type="text/javascript"></script></div>
</div>

<div id="infoContainer">
<h4><?php echo $this->res['name']?></h4>
<img src="<?php echo $this->res['img']?>" alt="<?php echo $this->res['name']?>" title="<?php echo $this->res['name']?>" />
<table cellpadding="0" cellspacing="0" id="infoTable" >
	<tr><td class="td1">规格</td><td class="td2"><?php echo $this->res['size']?></td><td class="td1">重量</td><td class="td2"><?php echo $this->res['weight']?></td></tr>
	<tr><td class="td1">详细描述</td><td class="td3" colspan="3"><?php echo $this->res['text_desc']?></td></tr>
	<tr><td class="td1">卖家</td><td class="td2"><?php echo $this->res['owner']?></td><td class="td1">成交日期</td><td class="td2"><?php echo $this->res['date']?></td></tr>
	<?php if(isset($this->res['type'])){?>
	<tr><td class="td1">交易类型</td><td class="td2" colspan="3"><?php echo $this->res['type']?></td></tr>
	<?php }?>
	<?php if(isset($this->res['link'])){?>
	<tr><td class="td1">出处连接</td><td class="td2" colspan="3"><?php echo $this->res['link']?></td></tr>
	<?php }?>
</table>

<div id="inputContainer">
<p>请在如下的输入框中输入您猜测的价格，实际成交价上下浮动5%的范围内就算猜中。可连续猜测5次。</p>
<form>
	<input type="text" name="price" id="price" readonly="readonly"/>
	<input type="button" value="猜一下" id="button" onclick="caiJiaGe()"/>
</form>
	<table id="numPicker">
		<tr><td width="33%">1</td><td width="33%">2</td><td>3</td></tr>
		<tr><td>4</td><td>5</td><td>6</td></tr>
		<tr><td>7</td><td>8</td><td>9</td></tr>
		<tr><td>0</td><td>00</td><td>000</td></tr>
		<tr><td colspan="3">清除</td></tr>
	</table>
<p id="msgBox">提示信息</p>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
	$("#price").val("");
	$("#numPicker tr td").bind('click',function(){
		price=$("#price").val();
		tempVal=$(this).text();
		if('清除'==tempVal){
			$("#price").val("");
			return;
		}else{
			price+=tempVal;
		}
		if(0==parseInt(price)){
			$("#price").val("");
		}else if(9999999<=parseInt(price)){
			$("#price").val("9999999");
		}else{
			$("#price").val(price);
		}
		
	})
})

var i=1;

function caiJiaGe(){
	originalPirce=<?php echo $this->res['price']?>;
	minPrice=Math.round(originalPirce*0.95);
	maxPrice=Math.round(originalPirce*1.05);
	inputPrice=$("#price").val();

	if(i<=5){
    	if(""==inputPrice){
    		msg="请输入价格";
    		return;
    	}else{
    		if(inputPrice<minPrice){
    			msg="价格低了！";
    		}else if(inputPrice>maxPrice){
				msg="价格高了！";
        	}else{
				msg="大侠您好眼力！"+"实际价格为"+originalPirce;
            }

			if(1==i){
				ajaxSubmit(inputPrice);
			}

			if(5==i){
				msg+="实际价格为"+originalPirce;
			}

            
    	}
	}
	if($("#msgBox").is(":hidden")){
    	$("#msgBox").text(msg);
		$("#msgBox").fadeIn(1000);
	}else{
		$("#msgBox").hide();
		$("#msgBox").text(msg);
		$("#msgBox").show();
	}
	$("#price").val("");
	i++;
}

function ajaxSubmit(inputPrice){
	var str="price="+inputPrice+"&id="+<?php echo $this->res['id']?>;
	$.ajax({
		type: "GET",	
	  	url: "<?php echo $this->baseUrl(); ?>/cai-jia-ge/ajax-input-price",
	  	data: str
	});
}


</script>